package com.hzcx.app.simplechat.ui.publicui;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.base.BaseDialog;
import com.hzcx.app.simplechat.util.empty.EmptyUtils;

import butterknife.BindView;

public class PublicTipsDialog extends BaseDialog {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_content)
    TextView tvContent;
    @BindView(R.id.view_line)
    View viewLine;
    @BindView(R.id.tv_confirm)
    TextView tvConfirm;

    private String title;
    private String content;
    private OnPublicTipsClickListener listener;

    public PublicTipsDialog(@NonNull Context context,String title,String content,OnPublicTipsClickListener listener) {
        super(context);
        this.title=title;
        this.content=content;
        this.listener=listener;
    }

    @Override
    public int getLayout() {
        return R.layout.dialog_public_tips;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {
        // 默认无标题，需传入标题显示
        if (EmptyUtils.isNotEmpty(title)) {
            tvTitle.setText(title);
            tvTitle.setVisibility(View.VISIBLE);
        }
        tvContent.setText(content);

        // 确定按钮事件
        tvConfirm.setOnClickListener(view -> {
            if (listener != null) {
                listener.publicTips();
            }
            dismiss();
        });
    }

    @Override
    public void initData() {

    }

    public interface OnPublicTipsClickListener {
        void publicTips();
    }
}
